//
//  Graph.h
//  AdvPropTestsCpp
//
//  Created by Brian Bogard on 2/24/12.
//  Copyright 2012 ASU. All rights reserved.
//

#ifndef AdvPropTestsCpp_Graph_h
#define AdvPropTestsCpp_Graph_h

#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <boost/tuple/tuple.hpp>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "Node.h"

using namespace std;

class Node;

class Graph
{
public:
    typedef boost::unordered_map< int, boost::unordered_map< int, vector< int > > > nodeDistances;
    typedef boost::unordered_map< int, double > selectionMap;
    typedef std::vector< boost::tuple< int, int > > edgeSetType;
    typedef boost::unordered_map< int, vector< int > > edgeMapType;
    typedef boost::unordered_map< int, Node > nodeMapType;

    Graph();
    Graph( const Graph & _graph );
    Graph & operator=( const Graph & _graph );
    void showGraphInfo();
    
    void addNode( int _ID, Node _node );
    void addEdge( int _sourceNode, int _destNode );
    void setNodeColor( int _ID, Node::COLOR _color );
    Node::COLOR getNodeColor( int _ID );
    void resetNodeColor( int _ID );
    static selectionMap degreeCentralityList( boost::shared_ptr< Graph > _graphObj );
    static selectionMap closenessCentralityList( boost::shared_ptr< Graph > _graphObj );
    static selectionMap DavidKempeSelection( boost::shared_ptr< Graph > _graphObj, int _maxDist );
    static void initializeActiveEdges( boost::shared_ptr< Graph > _graphObj, float _activeEdgeProb );
    static Graph::nodeDistances getNodeDistances( boost::shared_ptr< Graph > _graphObj );
  //  static double propagate( boost::shared_ptr< Graph > _graphObj );
    //Shahrzad
    static double propagate( boost::shared_ptr< Graph > _graphObj, int _maxPropagationdist );
    
    nodeMapType m_nodeMap;
    edgeMapType m_edgeMap;
    edgeSetType m_edgeSet;
    
private:

    boost::unordered_map< Node::COLOR, boost::unordered_set< int > > m_coloredNodes;
    
    
};

#endif
